/*
 * @Description: 借阅登记添加、编辑通用表单
 * @Author: Rfan
 * @Date: 2022-11-23 18:17:54
 * @LastEditTime: 2022-11-24 17:56:27
 */

import { DatePicker, Form, Input, InputNumber, Select } from 'antd';
import { useRetrieveUseContext } from '../../../contexts/RetrieveUseContext';
import { useEffect, useState } from 'react';
import { IFond } from '@/interfaces/fond';
import { IArchiveType } from '@/interfaces/archiveType';

const { Option } = Select;
interface ITransferFormProps {
  visible: boolean;
}

const RetrieveUseForm = (props: ITransferFormProps) => {
  const { visible } = props;
  const { resultsStatusList, retrieveUseTypeList } = useRetrieveUseContext();

  // 全宗列表
  const [fondList, setFondList] = useState<IFond[]>([]);
  // 档案类型列表
  const [ATList, setATList] = useState<IArchiveType[]>([]);

  useEffect(() => {}, [visible]);

  return (
    <>
      <Form.Item name="registrationTime" label="登记时间" rules={[{ required: true }]}>
        <DatePicker />
      </Form.Item>
      <Form.Item name="year" label="年度" rules={[{ required: true }]}>
        <Input allowClear />
      </Form.Item>

      <Form.Item name="fondsId" label="全宗">
        <Select>
          {fondList.map((item) => (
            <Option key={item.id} value={item.id}>
              {item.fondName}
            </Option>
          ))}
        </Select>
      </Form.Item>
      <Form.Item name="archiveTypeId" label="档案类型">
        <Select>
          {ATList.map((item) => (
            <Option key={item.id} value={item.id}>
              {item.atName}
            </Option>
          ))}
        </Select>
      </Form.Item>
      <Form.Item name="receiveBatchId" label="批次">
        <Input allowClear />
      </Form.Item>
      <Form.Item name="transferMode" label="交接方式">
        <Select>
          {retrieveUseTypeList.map((item: any) => (
            <Option key={item.id} value={item.id}>
              {item.name}
            </Option>
          ))}
        </Select>
      </Form.Item>
      <Form.Item name="folderCount" label="案卷数量">
        <InputNumber />
      </Form.Item>
      <Form.Item name="fileCount" label="文件数量">
        <InputNumber />
      </Form.Item>
      <Form.Item name="efileCount" label="电子文件数量">
        <InputNumber />
      </Form.Item>
      <Form.Item name="transferDataSize" label="移交数据量">
        <InputNumber />
      </Form.Item>
      <Form.Item name="transferVectorType" label="移交载体">
        <Input allowClear />
      </Form.Item>
      <Form.Item name="transferUnit" label="接收单位">
        <Input allowClear />
      </Form.Item>
      <Form.Item name="detectionJobId" label="规范性检测ID">
        <Input allowClear />
      </Form.Item>
      <Form.Item name="detectionResult" label="检测结果">
        <Select>
          {resultsStatusList.map((item: any) => (
            <Option key={item.id} value={item.id}>
              {item.name}
            </Option>
          ))}
        </Select>
      </Form.Item>
      <Form.Item name="registrant" label="填表人">
        <Input allowClear />
      </Form.Item>
      <Form.Item label="审核人">
        <Input allowClear />
      </Form.Item>
      <Form.Item name="remark" label="备注">
        <Input.TextArea placeholder="备注信息描述，最多可填写2000字" maxLength={2000} showCount />
      </Form.Item>
    </>
  );
};

export default RetrieveUseForm;
